﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using Emz.Core.Models.Enums;

namespace Emz.Core.Models
{
    public class Adjustment  : EntityBase<int>
    {
        [Required]
        [StringLength(50)]
        public string Code { get; set; }

        [StringLength(200)]
        public string Description { get; set; }
        
        public int AccountType { get; set; }
        [NotMapped]
        public AccountType AccountTypeEnum
        {
            get { return (AccountType)AccountType; }
            set { AccountType = (int)value; }
        }

        public bool IsAdditional { get; private set; }
        [NotMapped]        
        public AccountSign AccountSignEnum
        {
            get 
            { 
                return IsAdditional ? AccountSign.Credit : AccountSign.Debit; 
            }
            set 
            {
                IsAdditional = (int)value == 1;
            }
        }
    }
}
